Skip to content

feat: Embed Thank You Element in Joint SDK#89

Open
zach-will wants to merge 6 commits intomparticle-integrations:mainfrom
zach-will:feature/Embedd-tye-injoint-sdk
Open

feat: Embed Thank You Element in Joint SDK#89
zach-will wants to merge 6 commits intomparticle-integrations:mainfrom
zach-will:feature/Embedd-tye-injoint-sdk

Conversation

@zach-will
Copy link
Copy Markdown

@zach-will zach-will commented Apr 21, 2026

Background

Today, partners need to load Rokt resources independently in order to use shoppable ads. This has introduced confusion and added integration complexity. To simplify this, the Joint SDK will now be responsible for fetching the Thank You Element (TYE).

What Changed

  • Rokt Kit now handles the thank-you-journey extension as a special case. When this extension is present, it is no longer appended to the Rokt launcher URL. Instead, Rokt kit will fetch the TYE resource and register the extension with WSDK.
  • mParticle.rokt.use has been deprecated, as this functionality is now handled internally.
  • Updated TsConfig to fix local development issues with vitest

Testing and Verification

  • Conducted local test using stub config data.

Media

TODO

Expected config:

      "roktExtensions": [
        {"jsmap": null, "map": null, "maptype": "StaticList", "value": "instant-purchase"},
        {"jsmap": null, "map": null, "maptype": "StaticList", "value": "experiment-monitoring"},
        {"jsmap": null, "map": null, "maptype": "StaticList", "value": "thank-you-journey"}
      ],

@zach-will zach-will changed the title [test]: Embedd TYE in Joint SDK [test]: Embed TYE in Joint SDK Apr 21, 2026
@rmi22186 rmi22186 changed the title [test]: Embed TYE in Joint SDK feat: Embed Than You Element in Joint SDK Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Can you add a few tests also?

Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts
@rmi22186 rmi22186 changed the title feat: Embed Than You Element in Joint SDK feat: Embed Thank You Element in Joint SDK Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more comments

Comment thread src/Rokt-Kit.ts Outdated
return [protocol, resolvedDomain].join('');
}

function loadRoktScript(scriptId: string, source: string, appendToTarget: boolean = true) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a void, there isn't a need to return anything, unless I'm mistaken

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We return the script tag because we handle appending the script to the document differently for TYE and WSDK. For TYE we append the script to document as soon as the script is created, for WSDK we append script to document once the script has finished loading.

I wasn't sure if there was a reason why WSDK script is appended to the DOM much later, but I didn't want to break any behavior that could be related.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now. There's different behavior happening when creating scripts for TYE vs Rokt SDK because of onLoad/onError. The

how about something like:

function loadRoktScript(
    scriptId: string,
    source: string,
    handlers?: { onload?: () => void; onerror?: (e: Event | string) => void },
  ): void {
    if (document.getElementById(scriptId)) return; // resolves the preexisting script issue

    const target = document.head || document.body;
    const script = document.createElement('script');
    script.id = scriptId;
    script.type = 'text/javascript';
    script.src = source;
    script.async = true;
    script.crossOrigin = 'anonymous';
    (script as HTMLScriptElement & { fetchPriority: string }).fetchPriority = 'high';
    if (handlers?.onload) script.onload = handlers.onload;
    if (handlers?.onerror) script.onerror = handlers.onerror;
    target.appendChild(script);
  }

Copy link
Copy Markdown
Collaborator

@rmi22186 rmi22186 Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to delay appending due to having the onload/onerror

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Comment thread test/src/tests.spec.ts Outdated
Comment thread test/src/tests.spec.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
Copy link
Copy Markdown
Collaborator

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will do some testing first to make sure existing script loading is unaffected. Then will merge and release tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants